package demo2;

import javafx.print.Printer;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-08-09
 * Time: 10:15
 */
public class TestDemo4 {

    public static void main1(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("text.txt")){
            byte[] bytes = {'1','2','3','4','5','6'};
            outputStream.write(bytes,3,2);
            outputStream.flush();
        }catch(IOException e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("text.txt")){
            String s = "你好中国";
            byte[] bytes = s.getBytes();
            outputStream.write(bytes);
        }catch(IOException e){
            e.printStackTrace();
        }
    }




}
